<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of LoginAction
 *
 * @author Administrator
 */
class LoginAction extends Action{
    
    function index(){
        $this->display();
    }
    
    function logon(){
        
        $name = htmlspecialchars($_POST['username']);
        $pwd = md5($_POST['password']);
        
        $user = array('name' => $name, 'pwd' => $pwd);
        $user = M('rhost')->where($user)->find();
        
        if($user){
            $user['pwd'] = null;
            $_SESSION[$user['name']] = $user;
        }
    }
    
}
